package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVo1;
import cn.tedu._04mybatis.pojo.vo.CommentVo2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public  interface CommentMapper {
    @Insert("INSERT INTO comment(id,content,created,user_id,weibo_id) VALUES (#{id},#{content},#{created},#{userId},#{weiboId})")
    public int insertComment(Comment comment);

    @Delete("DELETE FROM comment WHERE id=#{cid}")
    int deleteComment(Long cid);

    @Select("SELECT content,user_id userId,weibo_id weiboId FROM comment WHERE id=#{id}")
    CommentVo1 selectCommentVo1(Long id);

    @Select("SELECT content,user_id userId FROM comment WHERE weibo_id=#{wid}")
    List<CommentVo2> selectCommentVo2(Long wid);
}
